﻿using DC2010.Objects.Data;
using DC2010.Objects;
namespace DC2010
{
    public static class Extensions
    {
        public static int ToInt(this string current)
        {
            int convertedValue;
            int.TryParse(current, out convertedValue);
            return convertedValue;
        }

        public static ItemData GetItemDataFromCode(this string code)
        {
            if (!string.IsNullOrEmpty(code))
            {
                return Root.I.ItemSystem.GetData(code);
            }

            return null;
        }
		
        public static CreatureData GetCreatureDataFromCode(this string code)
        {
            if (!string.IsNullOrEmpty(code))
            {
                return Root.I.CreatureSystem.GetData(code);
            }

            return null;
        }		
    }
}
